package avoid_literals_in_if_condition;

public class Test {
	private static final int MAX_NUMBER_OF_REQUESTS = 10;
	public void checkRequests() {
		int i = 0;
		String aString = "";
		double aDouble = 0.0;
		
	    if (i == 10) {                        // magic number, buried in a method
	      doSomething();
	    }

	    if (i == MAX_NUMBER_OF_REQUESTS) {    // preferred approach
	      doSomething();
	    }

	    if (aString.indexOf('.') != -1) {}     // magic number -1, by default ignored
	    if (aString.indexOf('.') >= 0) { }     // alternative approach

	    if (aDouble > 0.0) {}                  // magic number 0.0
	    if (aDouble >= Double.MIN_VALUE) {}    // preferred approach
	}
	
	void doSomething() { }
}
